<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8118");
//curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);


curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 7);
curl_setopt($ch, CURLOPT_URL, $this->url);
if ($this->post !== false) {
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $this->post);
}
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie_file);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie_file);
// curl_setopt($ch, CURLOPT_FILE, $fd);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");

ob_start();
curl_exec ($ch);
curl_close ($ch);
$result = ob_get_contents();
ob_end_clean();

if(strcmp($result, "") != 0) {
	$fd = fopen($this->filename, "w");
	fwrite($fd, $result);
	fclose($fd);
	return TRUE;
} else {
	echo ">>>=== ".date("Y-m-d H:i:s")." CURL FAILED ===<<<\n";
	return FALSE;
}



?>